﻿<local:WeatherControl x:Class="EmperialApps.WeatherSpark.WeatherSummary"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:local="clr-namespace:EmperialApps.WeatherSpark"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:System="clr-namespace:System;assembly=mscorlib"
                      FontFamily="{StaticResource PhoneFontFamilyNormal}"
                      FontSize="{StaticResource PhoneFontSizeNormal}"
                      Foreground="{StaticResource PhoneForegroundBrush}"
                      mc:Ignorable="d"
                      d:DesignHeight="131"
                      d:DesignWidth="960">

    <Grid x:Name="LayoutRoot"
          Margin="0,12,0,0"
          Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*"
                           local:WeatherControl.Level="CloudCoverDetails" />
            <RowDefinition x:Name="GraphRow"
                           Height="5*" />
            <RowDefinition Height="*"
                           local:WeatherControl.Level="PrecipitationDetails" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <System:Double x:Key="PrimaryLineThickness">3</System:Double>
            <System:Double x:Key="SecondaryLineThickness">2</System:Double>
            <System:Double x:Key="TertiaryLineThickness">1</System:Double>

            <System:Double x:Key="SmallLabelSize">16</System:Double>

            <DataTemplate x:Key="DateLabelTemplate">
                <TextBlock Style="{StaticResource PhoneTextSubtleStyle}"
                           Padding="4,2"
                           FontSize="{StaticResource SmallLabelSize}"
                           Text="{Binding}" />
            </DataTemplate>
        </Grid.Resources>

        <TextBlock Style="{StaticResource PhoneTextTitle3Style}"
                   x:Name="ForecastDescription"
                   Margin="0"
                   HorizontalAlignment="Right"
                   Text="{Binding Mode=OneTime, Source={StaticResource Localized}, Path=Strings.Graph_LoadingFallback}"
                   local:WeatherControl.Level="TemperatureSummary" />
        <StackPanel Grid.Row="0"
                    Background="{StaticResource PhoneSemitransparentBrush}"
                    Orientation="Horizontal">
            <StackPanel.Resources>
                <Style BasedOn="{StaticResource PhoneTextTitle3Style}"
                       TargetType="TextBlock">
                    <Setter Property="Margin"
                            Value="6,0,10,0" />
                </Style>
                <Style TargetType="Path">
                    <Setter Property="Margin"
                            Value="6,0,2,0" />
                </Style>
            </StackPanel.Resources>

            <!-- Description -->
            <TextBlock x:Name="ForecastTitle"
                       FontFamily="{StaticResource PhoneFontFamilyNormal}"
                       Text="{Binding Mode=OneTime, Source={StaticResource Localized}, Path=Strings.Graph_LoadingFallback}"
                       local:WeatherControl.Level="TemperatureSummary" />

            <!-- Temperature (http://modernuiicons.com/ thermometer) -->
            <Path Data="M 5.0,12.8  C 6.3,13.1 7.3,14.2 7.3,15.5  C 7.3,17.0 6.0,18.3 4.5,18.3  C 2.0,18.3 1.8,17.0 1.8,15.5  C 1.8,14.2 2.7,13.1 4.0,12.8  L 4.0,2.0  5.0,2.0  z  M 6.7,11.5  C 8.0,12.2 9.0,13.8 9.0,15.5  C 9.0,18 7.0,20 4.5,20.0  C 2.0,20 0.0,18 0.0,15.5  C 0.0,13.8 1.0,12.2 2.3,11.5  L 2.3,2  C 2.3,0.9 3.4,0 4.5,0.0  C 5.6,0.0 6.5,0.9 6.7,1.5  z"
                  Fill="{StaticResource PhoneAccentBrush}"
                  VerticalAlignment="Center" />
            <TextBlock x:Name="CurrentTemperatureLabel" />

            <!-- Humidity -->
            <Path Fill="{StaticResource HumidityBrush}"
                  VerticalAlignment="Center"
                  local:WeatherControl.Level="HumiditySummary">
                <Path.Data>
                    <EllipseGeometry Center="8.0,8.0"
                                     RadiusX="8.0"
                                     RadiusY="8.0" />
                </Path.Data>
            </Path>
            <TextBlock x:Name="CurrentHumidityLabel"
                       local:WeatherControl.Level="HumiditySummary" />

            <!-- Pressure -->
            <Path Data="M 20,6  L 17,15  C 13.5,24.5 3.5,14.5 12,10  z  M 0,15  C 0,-5 28,-5 28,15  L 26,15  C 26,-2 2,-2 2,15  z"
                  Fill="{StaticResource PressureBrush}"
                  VerticalAlignment="Center"
                  local:WeatherControl.Level="PressureSummary" />
            <TextBlock x:Name="CurrentPressureLabel"
                       Text="1000 hPa"
                       local:WeatherControl.Level="PressureSummary" />

            <!-- Precipitation -->
            <Path Data="M 6.8,0.0  C 6.4,1.6 4.0,4.6 2.9,6.0  C 1.8,7.4 0.0,9.6 0.0,12.4  C 0.0,16.6 2.7,19.8 6.8,19.8  C 10.9,19.8 13.6,16.6 13.6,12.4  C 13.6,9.6 11.8,7.4 10.7,6.0  C 9.6,4.6 7.3,1.6 6.8,0.0  z"
                  Fill="{StaticResource PrecipitationBrush}"
                  VerticalAlignment="Center"
                  local:WeatherControl.Level="PrecipitationSummary" />
            <TextBlock x:Name="CurrentPrecipitationLabel"
                       local:WeatherControl.Level="PrecipitationSummary" />

            <!-- Cloud Cover (http://modernuiicons.com/ cloud) -->
            <Path Data="M 4.0,20.5  C 1.8,20.5 0.0,18.8 0.0,16.6  C 0.0,14.7 1.4,13.1 3.2,12.7  C 3.2,12.5 3.2,12.2 3.2,11.9  C 3.2,8.9 5.5,6.5 8.5,6.3  C 9.8,2.6 13.3,0.0 17.4,0.0  C 21.3,0.0 24.7,2.4 26.2,5.8  C 27.3,5.1 28.7,4.8 30.1,4.8  C 34.5,4.8 38.0,8.3 38.0,12.7  C 38.0,17.0 34.4,20.5 30.0,20.5  z"
                  Fill="{StaticResource CloudCoverBrush}"
                  VerticalAlignment="Center"
                  local:WeatherControl.Level="CloudCoverSummary" />
            <TextBlock x:Name="CurrentCloudCoverLabel"
                       local:WeatherControl.Level="CloudCoverSummary" />

            <!-- Wind -->
            <Path Data="M 0.0,5.0 L 9.0,5.0 A 2.0,2.0 0 1 0 7.0,2.5  M 0.0,8.0 L 15.5,8.0 A 2.6,2.6 0 1 0 14.0,3.5  M 0.0,11.0 L 12.5,11.0 A 2.2,2.2 0 1 1 10.5,14.0  M 0.0,15.5 z"
                  Stroke="{StaticResource WindBrush}"
                  StrokeEndLineCap="Round"
                  StrokeThickness="1.5"
                  VerticalAlignment="Center"
                  local:WeatherControl.Level="WindSummary" />
            <TextBlock local:WeatherControl.Level="WindSummary">
                <Run x:Name="CurrentWindSpeedLabel" />
                <Run x:Name="CurrentWindDirectonLabel"
                     FontSize="{StaticResource PhoneFontSizeSmall}" />
            </TextBlock>
        </StackPanel>

        <Path x:Name="TimeGridLines"
              Grid.Row="1"
              Grid.RowSpan="3"
              Stroke="{StaticResource PhoneSubtleBrush}"
              StrokeThickness="{StaticResource TertiaryLineThickness}" />
        <Grid x:Name="GridLinesContainer"
              Grid.Row="2">
            <Rectangle x:Name="NightBackground"
                       Fill="SteelBlue"
                       Opacity="0.4">
                <Rectangle.Clip>
                    <PathGeometry />
                </Rectangle.Clip>
            </Rectangle>
            <Path x:Name="MinorTemperatureGridLines"
                  Stroke="{StaticResource PhoneSubtleBrush}"
                  StrokeThickness="{StaticResource TertiaryLineThickness}" />
            <Path x:Name="MajorTemperatureGridLines"
                  Stroke="{StaticResource PhoneSubtleBrush}"
                  StrokeThickness="{StaticResource SecondaryLineThickness}" />
        </Grid>

        <Line x:Name="ExtremeTemperatureLine"
              Grid.Row="2"
              StrokeThickness="{StaticResource SecondaryLineThickness}" />
        <Canvas Grid.Row="1"
                Grid.RowSpan="3"
                local:WeatherControl.Level="TemperatureSummary">
            <Line x:Name="CurrentTimeLine"
                  Stroke="{StaticResource PhoneAccentBrush}"
                  StrokeDashArray="2 2"
                  StrokeThickness="{StaticResource PrimaryLineThickness}" />
        </Canvas>
        <Canvas Grid.Row="2">
            <Polyline x:Name="TemperatureTrace"
                      Stretch="None"
                      Stroke="{StaticResource PhoneContrastBackgroundBrush}"
                      StrokeStartLineCap="Square"
                      StrokeThickness="{StaticResource SecondaryLineThickness}"
                      local:WeatherControl.Level="TemperatureDetails" />
        </Canvas>
        <TextBlock Style="{StaticResource PhoneTextSubtleStyle}"
                   x:Name="GridLineLabel"
                   Grid.Row="2"
                   Margin="0,-4"
                   FontSize="{StaticResource SmallLabelSize}"
                   HorizontalAlignment="Left"
                   Text="20"
                   VerticalAlignment="Top" />

        <Rectangle x:Name="CloudCoverTrace"
                   Grid.Row="1"
                   Fill="{StaticResource CloudCoverBrush}"
                   local:WeatherControl.Level="CloudCoverDetails">
            <Rectangle.Clip>
                <PathGeometry />
            </Rectangle.Clip>
        </Rectangle>

        <Rectangle x:Name="PrecipitationTrace"
                   Grid.Row="3"
                   Fill="{StaticResource PrecipitationBrush}"
                   local:WeatherControl.Level="PrecipitationDetails">
            <Rectangle.Clip>
                <PathGeometry />
            </Rectangle.Clip>
        </Rectangle>
    </Grid>
</local:WeatherControl>
